package com.cac.demo.newCode.materialStorage.controller;

import com.cac.demo.newCode.materialStorage.dto.InventoryDetailDTO;
import com.cac.demo.newCode.materialStorage.service.InventoryDetailsService;
import com.cac.demo.newCode.utils.MaterialUtil;
import com.cac.demo.util.adapter.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * 库存台账详细信息
 */
@RestController
@RequestMapping("/InventoryDetailsController")
@Slf4j
@Api(tags = "库存台账详细信息")
public class InventoryDetailsController {
    @Resource
    InventoryDetailsService inventoryDetailsService;
    @Resource
    MaterialUtil materialUtil;
    @PostMapping("/PageInventoryDetails")
    @ApiOperation(value = "库存台账详细信息分页接口")
    public ResponseMsg<Object> PageInventoryDetails(@RequestBody InventoryDetailDTO inventoryDetailDTO){
        return inventoryDetailsService.PageInventoryDetails(inventoryDetailDTO);
    }

    @PostMapping("/getMaterial")
    @ApiOperation(value = "查询物料类型")
    public ResponseMsg<Object> getMaterial(@RequestBody HashMap<String,String> hashMap){
        String s = hashMap.get("message");
        return new ResponseMsg<>().setResponseBody(materialUtil.getMaterialDTO(s)) ;
    }
}
